package com.lwei.tallybook.client.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lwei.tallybook.base.domain.AccountBookBill;
import com.lwei.tallybook.base.dto.Message;
import com.lwei.tallybook.service.service.AccountBookBillService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import java.util.Date;
import java.util.List;

import static com.lwei.tallybook.client.enums.ServletEnum.*;

/**
 *  账单控制层
 * @author sks.lwei
 */
@RestController
@RequestMapping("/api/bill")
public class BillController extends BaseController{

    @Resource
    private AccountBookBillService accountBookBillService;

    /**
     * 账单生成
     * 指定时间范围
     */
    @RequestMapping("/creat-bill")
    public Message creatBill(Date begin, Date end){
        accountBookBillService.creatAccountBookBillAll(begin, end);
        return Message.SUCCESS;
    }

    /**
     * 账单清算
     */
    @RequestMapping("/kill-book")
    public Message killBooks(String billUuid){
        accountBookBillService.killBill(billUuid);
        return Message.SUCCESS;
    }

}
